import Editor from "../editor"
import { Operation } from './operation'
import type { Selection } from "../models/selection_model"
export class SetSelectionOperation extends Operation {
    constructor(private selection_: Selection) {
        super()
    }
    apply(editor: Editor) {
        editor.getSelectionModel()?.setSelection(this.selection_)
    }
    inverse(): void {
        throw new Error("Method not implemented.")
    }
    reverse(): Operation[] {
        return [
            new SetSelectionOperation({
                anchor: this.selection_?.anchor || 0,
                focus: this.selection_?.focus || 0
            })
        ];
    }

}

export default SetSelectionOperation